program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

procedure AddToEnd (var head:pelement; num:integer);
  var
    current: pelement;
  begin
  if (head<>nil) then
    begin
        current:=head;
        while(current^.next<>nil) do
            current:=current^.next;
            new(current^.next);
            current^.next^.value:=num;
            current^.next^.next:=nil;end else
    AddToBegin(head, num);  //written in other file
end;

begin
  { TODO -oUser -cConsole Main : Insert code here }
end.
